#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
// #include "grader.cpp"
#include "graph.h"
using namespace std;
const int N = 205;
int fa[N],du[N],f[N][N],dis[N][N],cnt[N],n,rt;
void dfs(int &u,int dad)
{ 
    fa[u = ++n] = LastRoad();du[u] = NumberOfRoads();
    if(~fa[u])f[u][fa[u]] = dad;
    for(int i = 1;i <= du[u];i++)
    {
        int &v = f[u][i];
        if(v)continue;
        Move(i,2);
        if(Color() == 1)dfs(v,u);
        else
        {
            int lst = LastRoad();v = u;
            Move(lst,3);
            while(Color() != 3)Move(fa[v],2),v = f[v][fa[v]];
            f[v][lst] = u;Move(lst,2);
        }
    }
    if(~fa[u])Move(fa[u],1);
}
void Inspect(int R)
{
    dfs(rt,0);
    memset(dis,0x3f,sizeof dis);
    for(int i = 1;i <= n;dis[i][i] = 0,i++)
        for(int j = 1;j <= du[i];j++)
            dis[i][f[i][j]] = 1;
    for(int k = 1;k <= n;k++)
        for(int i = 1;i <= n;i++)for(int j = 1;j <= n;j++)
            dis[i][j] = min(dis[i][j],dis[i][k]+dis[k][j]);
    for(int i = 1;i <= n;i++)for(int j = i+1;j <= n;j++)
        cnt[dis[i][j]]++;
    for(int i = 1;i <= R;i++)
        Answer(i,cnt[i]);
}